<?php

namespace app\admin\model;

use think\Model;

class DocCon extends Model
{
    //category搜索器
    public function searchCidAttr($query, $value)
    {
        return $value ? $query->where('cid', $value) : '';
    }

    //title搜索器
    public function searchTitleAttr($query, $value)
    {
        return $value ? $query->where('title', 'like', '%'.$value.'%') : '';
    }

    //status搜索器
    public function searchStatusAttr($query, $value)
    {
        return $value ? $query->where('status', $value) : '';
    }

    //status获取器
    public function getStatusTextAttr($value,$data)
    {
        $status = [1 => '未审核', 2 => '已审核'];
        return $status[$data['status']];
    }

    //convert_status获取器
    public function getConvertStatusTextAttr($value,$data)
    {
        $status = [1 => '等待转换', 2 => '已转换',3=>'转换失败'];
        return $status[$data['convert_status']];
    }
}